<script setup lang="ts">
// 年龄范围
import {computed} from "vue";

const ageArr = Array.from({ length: 150 }, (val, i) => i)

const props = defineProps({
  value: {
    type: Number,
    required: false
  }
})

const emit = defineEmits(['update:value'])

const valueComputed = computed({
  get() {
    return props.value
  },
  set(value) {
    emit('update:value', value)
  }
})
</script>

<template>
  <el-select v-model="valueComputed">
    <el-option label="不限年龄" :value="-1"/>
    <el-option v-for="age in ageArr" :key="age" :label="age" :value="age"/>
  </el-select>
</template>

<style lang="less" scoped>
  .el-select {
    width: 100%;
  }
</style>